﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<App.Views.ViewModels.RegistrationInfoViewModel>" %>    
<style type="text/css"> 
body{font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;
     margin:0;padding:0;text-align:center;font-size:12px;color:#333;line-height:24px}
ul,li{margin:0;padding:0;list-style:none;float:left}
    .hidden_panel    {
        display:none;
    }
    div.button {
	    height: 20px;	
	    width: 40px;	    	    
	    font-size: 14px;
	    color: #C7D92C;
	    text-align: center;
    }    
.server_panel{padding-left:10px;float:left;width:98%; padding-top:0;}
.server_panel fieldset
{
    border:none;
    padding : 0;    
 }
.server_panel ul.tab_box{float:left;width:99%;border-bottom:3px solid #cc0001;height:27px}
.tab_off{margin-right:2px}
.tab_off a{width:90px;height:27px;line-height:27px;color:#000;
           background:url(/images/tab_bg.gif) no-repeat;display:block}
.tab_off a:hover{text-decoration:none;color:#000;}
.tab_on a{background-position:0 -27px;color:#fff;font-weight:bolder}
.tab_on a:hover{color:#fff}
.tab_last{margin-right:0}
.content{border:1px solid #c1c1c1;border-top:0;
                  float:left; width:99%; padding-top:21px;padding-left:0}
</style>  	
<script type="text/javascript" src="../../Scripts/ajaxupload.js"></script>
<script type="text/javascript" src="../../Scripts/Nation.js"></script>
<script type="text/javascript">
    function Upload(id) {
        var button = $('#btnUpload' + id), interval;
        new AjaxUpload(button, {
            action: '/RegistrationInfo/UploadFile/<%:Model.DeadNO %>_' + id,
            name: 'uploadFile',
            onSubmit: function (file, ext) {
                button.text('上传...');
                this.disable();
                interval = window.setInterval(function () {
                    var text = button.text();
                    if (text.length < 13) {
                        button.text(text + '.');
                    } else {
                        button.text('上传...');
                    }
                }, 200);
            },
            onComplete: function (file, response) {
                button.text('上传');
                window.clearInterval(interval);
                this.enable();
                $('#imgAppendix' + id).attr("src", "/uploads/" + response + "?id=" + (new Date()).getDate());
                $('#Appendix' + id).val(response);
            }
        });
    }
    $(document).ready(function () {
        $('#DeadTime').datetimebox({
            showSeconds: false
        });
        //$('#DeadTime').datetimebox('setValue',new Date())
        createNationSelect("DeadNation", "<%=Model.DeadNation %>");
        $("#tab_head").find("li").click(function () {
            $("#tab_head").find("li").removeClass("tab_on");
            var a = $(this).addClass("tab_on").attr("id");
            $("#registration_panel").find(".hidden_panel").hide();
            $("#f" + a).show();
        });
        $("#fdeadinfo").show();
        Upload(1);
        Upload(2);
        Upload(3);
        Upload(4);
    });    
</script>
    <% using (Html.BeginForm()) {%>
        <%: Html.ValidationSummary(true) %>   
    <div class="server_panel">
        <ul class="tab_box" id="tab_head">
			<li class="tab_off tab_on" id="deadinfo"><a href="#" title="死者信息">死者信息</a></li>
			<li class="tab_off" id="familyinfo"><a href="#" title="亲属信息">亲属信息</a></li>
			<li class="tab_off tab_last" id="appendixinfo"><a href="#" title="附件信息"  >附件信息</a></li>			
		</ul>    
        <div class="content" id="registration_panel">     
            <% bool isAdd = Request.Url.AbsolutePath.EndsWith("Add"); %>                       
        <table class="hidden_panel" id="fdeadinfo">                                    
        <tr>
            <td><%: Html.LabelFor(model => model.DeadNO) %></td>
            <td class="Lalign">
                <%: Html.TextBoxFor(model => model.DeadNO) %>
                <%: Html.ValidationMessageFor(model => model.DeadNO) %>
            </td>
            <td><%: Html.LabelFor(model => model.DeadName)%></td>
            <td class="Lalign">
                <%: Html.TextBoxFor(model => model.DeadName) %>
                <%: Html.ValidationMessageFor(model => model.DeadName) %>
            </td>
        </tr>
        <tr>
            <td><%: Html.LabelFor(model => model.DeadIDCard)%></td>
            <td class="Lalign">
                <%: Html.TextBoxFor(model => model.DeadIDCard) %>
                <%: Html.ValidationMessageFor(model => model.DeadIDCard) %>
            </td>
            <td><%: Html.LabelFor(model => model.DeadSex)%></td>
            <td class="Lalign">
                <select name="DeadSex" id="DeadSex">
                    <option value="男">男</option>
                    <option value="女">女</option>
                </select>
                <script type="text/javascript">
                    $("#DeadSex").val("<%:Model.DeadSex %>")
                </script>
            </td>
        </tr>
        <tr>
            <td><%: Html.LabelFor(model => model.DeadAge)%></td>
            <td class="Lalign">
                <%: Html.TextBoxFor(model => model.DeadAge) %>
                <%: Html.ValidationMessageFor(model => model.DeadAge) %>
            </td>
            <td><%: Html.LabelFor(model => model.DeadNation)%></td>
            <td class="Lalign">
                <select id="DeadNation" name="DeadNation"></select>                
            </td>
        </tr>
        <tr>
            <td><%: Html.LabelFor(model => model.DeadCity)%></td>
            <td class="Lalign">
                <select id="DeadCity" name="DeadCity">
                    <% foreach (var c in (IEnumerable<App.Models.tb_City>)ViewData["cityList"])
                       { %>
                       <option value='<%=c.CityName %>'><%=c.CityName %></option>
                    <%} %>
                </select>     
                <script type="text/javascript">
                    $("#DeadCity").val('<%=Model.DeadCity %>');
                </script>           
            </td>
            <td><%: Html.LabelFor(model => model.Residence)%></td>
            <td class="Lalign">
                <%: Html.TextBoxFor(model => model.Residence) %>
                <%: Html.ValidationMessageFor(model => model.Residence) %>
            </td>
        </tr>
        <tr>            
           <td><%: Html.LabelFor(model => model.BurialMode)%></td>
            <td class="Lalign">
                <select id="BurialMode" name="BurialMode">
                   <option value="火葬">火葬</option>
                   <option value="土葬">土葬</option>
                   <option value="运送">运送</option>
                </select>     
                <script type="text/javascript">
                    $("#BurialMode").val('<%=Model.BurialMode %>');
                </script>           
            </td>
            <td><%: Html.LabelFor(model => model.DeadTime)%></td>
            <td class="Lalign">
                <%: Html.TextBoxFor(model => model.DeadTime)%>     
                <script type="text/javascript">
                    $("#DeadTime").attr("readonly", "readonly");
                </script>           
            </td>
        </tr>
        <tr>
            <td><%: Html.LabelFor(model => model.DeadPlace)%></td>
            <td class="Lalign">
                <%: Html.TextBoxFor(model => model.DeadPlace) %>
                <%: Html.ValidationMessageFor(model => model.DeadPlace) %>
            </td>
            <td><%: Html.LabelFor(model => model.DeadReason)%></td>
            <td class="Lalign">
                <%: Html.TextBoxFor(model => model.DeadReason) %>
                <%: Html.ValidationMessageFor(model => model.DeadReason) %>
            </td>
        </tr>
        <tr>
            <td><%: Html.LabelFor(model => model.WorkUnit)%></td>
            <td class="Lalign">
                <%: Html.TextBoxFor(model => model.WorkUnit)%>
                <%: Html.ValidationMessageFor(model => model.WorkUnit)%>
            </td>
            <td><%: Html.LabelFor(model => model.LifetimeJob)%></td>
            <td class="Lalign">
                <%: Html.TextBoxFor(model => model.LifetimeJob)%>
                <%: Html.ValidationMessageFor(model => model.LifetimeJob)%>
            </td>
        </tr>    
        </table> 
        <table class="hidden_panel" id="ffamilyinfo">                                    
        <tr>
            <td><%: Html.LabelFor(model => model.FamilyName)%></td>
            <td class="Lalign">
                <%: Html.TextBoxFor(model => model.FamilyName)%>
                <%: Html.ValidationMessageFor(model => model.FamilyName)%>
            </td>
            <td><%: Html.LabelFor(model => model.FamilyIDCard)%></td>
            <td class="Lalign">
                <%: Html.TextBoxFor(model => model.FamilyIDCard)%>
                <%: Html.ValidationMessageFor(model => model.FamilyIDCard)%>
            </td>
        </tr>
        <tr>
            <td><%: Html.LabelFor(model => model.FamilyPhone)%></td>
            <td class="Lalign">
                <%: Html.TextBoxFor(model => model.FamilyPhone)%>
                <%: Html.ValidationMessageFor(model => model.FamilyPhone)%>
            </td>
            <td><%: Html.LabelFor(model => model.FamilyRelationship)%></td>
            <td class="Lalign">
                <%: Html.TextBoxFor(model => model.FamilyRelationship)%>
                <%: Html.ValidationMessageFor(model => model.FamilyRelationship)%>
            </td>
        </tr>
        <tr>
            <td><%: Html.LabelFor(model => model.FamilyAddress)%></td>
            <td class="Lalign">
                <%: Html.TextBoxFor(model => model.FamilyAddress)%>
                <%: Html.ValidationMessageFor(model => model.FamilyAddress)%>
            </td>
            <td><%: Html.LabelFor(model => model.FamilyPostcode)%></td>
            <td class="Lalign">
                <%: Html.TextBoxFor(model => model.FamilyPostcode)%>
                <%: Html.ValidationMessageFor(model => model.FamilyPostcode)%>
            </td>
        </tr>
        </table>
        <table class="hidden_panel" id="fappendixinfo">                                    
        <tr>
            <td><%: Html.LabelFor(model => model.Appendix1) %><div id="btnUpload1" class="button">上传</div>	</td>
            <td class="Lalign">
                <%: Html.HiddenFor(model => model.Appendix1) %>
                <img src="/uploads/<%:Model.Appendix1%>" alt="附件1" width="100" height="100" id="imgAppendix1" />   
            </td>
            <td><%: Html.LabelFor(model => model.Appendix2) %><div id="btnUpload2" class="button">上传</div>	</td>
            <td class="Lalign">
                <%: Html.HiddenFor(model => model.Appendix2) %>
                <img src="/uploads/<%:Model.Appendix2%>" alt="附件2" width="100" height="100" id="imgAppendix2" />
            </td>
        </tr>                             
        <tr>
            <td>
                <%: Html.LabelFor(model => model.Appendix3) %> <div id="btnUpload3" class="button">上传</div>	               
            </td>
             <td class="Lalign">
                <%: Html.HiddenFor(model => model.Appendix3) %>
                <img src="/uploads/<%:Model.Appendix3%>" alt="附件3" width="100" height="100" id="imgAppendix3" />
            </td>
            
            <td>
                <%: Html.LabelFor(model => model.Appendix4) %><div id="btnUpload4" class="button">上传</div>
            </td>
            <td class="Lalign">
                <%: Html.HiddenFor(model => model.Appendix4) %>
                <img src="/uploads/<%:Model.Appendix4%>" alt="附件4" width="100" height="100" id="imgAppendix4" />
            </td>
        </tr>
        </table>        
        </div>
        <div>
            <%: Html.ValidationMessageFor(model => model.DeadTime)%>
        </div>
    </div>    
    <% } %>





